package com.cavy.platform.server.dto;

import com.cavy.platform.server.validator.FormatValidatorGroup;
import com.cavy.platform.server.validator.LastValidatorGroup;
import com.cavy.platform.server.validator.ProjectNameNotRepeat;
import com.cavy.platform.server.validator.WorkspaceExist;
import lombok.Data;

import javax.validation.GroupSequence;
import javax.validation.constraints.NotNull;

/**
 * @author 唐旭
 * @Date 2018/7/17
 */
@Data
@ProjectNameNotRepeat(message = "项目已存在", groups = LastValidatorGroup.class)
@GroupSequence({FormatValidatorGroup.class, LastValidatorGroup.class, ProjectCreateDto.class})
public class ProjectCreateDto {
    @NotNull(message = "项目名称不能为空", groups = FormatValidatorGroup.class)
    private String name;

    @NotNull(message = "工作空间不能为空", groups = FormatValidatorGroup.class)
    @WorkspaceExist(groups = LastValidatorGroup.class)
    private String workspace;

    public String getProjectPropertyName() {
        return "name";
    }
}
